`
https://leetcode.cn/problems/number-of-recent-calls/
`


var RecentCounter = function () {
  this.q = []
};

/** 
* @param {number} t
* @return {number}
*/
RecentCounter.prototype.ping = function (t) {
  this.q.push(t);
  while (this.q[0] < t - 3000) {
    // t 是递增的，所以可以从队头删除 3000 毫秒之前的请求
    this.q.shift();
  }

  return this.q.length;
};

/** 
* Your RecentCounter object will be instantiated and called as such:
* var obj = new RecentCounter()
* var param_1 = obj.ping(t)
*/